package com.example.springjpa.rabbitmq;

/**
 * @description:
 * @author: zsw
 * @time: 2021/7/31 9:46
 */

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

@Component
public class ReturnCallbackService implements RabbitTemplate.ReturnCallback {
    /*** @param message 消息对象 * @param replyCode 错误码 * @param replyText 错误信息 * @param exchange 交换机 * @param routingKey 路由键 */
    @Override
    public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
        System.out.println("消息对象===>:" + message);
        System.out.println("错误码===>:" + replyCode);
        System.out.println("错误信息===>:" + replyText);
        System.out.println("消息使用的交换器===>:" + exchange);
        System.out.println("消息使用的路由key===>:" + routingKey);
    }
}